package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeviceMapper {


    @Select("select COUNT(1) from device where device_name = #{deviceName}")
    int selectCountByDeviceName(String deviceName);

    void insertDevice(Device device);

    Page<DeviceVo> queryPageDevice(DevicePageQueryDto devicePageQueryDto);

    DeviceVo selectDeviceByiotId(String iotId);

    
    @Delete("DELETE FROM device WHERE iot_id = #{iotId}")
    int deleteDeviceByiotId(String iotId);


    int UpdateDevice(Device device);
    @Select("SELECT * FROM device WHERE device_name = #{deviceName}")
    Device selectByDeviceName(String deviceName);

    List<Long> selectNursingIdsByiotIdwithelder(String iotId);

    List<Long> selectNursingIdsByiotIdwithbed(String iotId);
}
